package com.ruoyi.culture.controller;


import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.culture.domain.RegisterInfo;
import com.ruoyi.culture.domain.RegisterPart;
import com.ruoyi.culture.service.RegisterInfoService;
import com.ruoyi.culture.service.feign.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/cultureUser")
@Api(tags = {"文创用户相关控制器"})
public class CultureUserController extends BaseController {


    @Autowired
    RegisterInfoService registerInfoService;



    @PostMapping("/register")
    @ApiOperation("文创用户信息注册")
    public AjaxResult addOne(@RequestBody RegisterPart registerPart) {
        registerInfoService.insert(registerPart);
        return success();
    }

    @PostMapping("/info/update")
    @ApiOperation("文创用户信息修改")
    public AjaxResult update(@RequestBody RegisterPart registerPart) {
        registerInfoService.update(registerPart);
        return success();
    }


    @GetMapping("/info/getOne")
    @ApiOperation("文创用户信息查询")
    public AjaxResult getOne(@RequestParam String username) {
        RegisterInfo registerInfo = registerInfoService.searchOne(username);
        return success(registerInfo);
    }
}
